/**
 * Framework for batch testing user profile models
 * Final project by Sergey Nepomnyachiy and Julia Polchin
 * Supervisor: Tsvi Kuflik
 *
 */
package core.generators;

/**
 * Generates doubles starting from given value and incrementing by 'step' for
 * the next one
 * 
 * @author Sergey&Julia
 * 
 */
public class StepDoubleGenerator extends FunctionGenerator<Double> {
	private final Double step;

	/**
	 * Step generator for doubles Note: no limit checking. Watch out for
	 * overflows
	 * 
	 * @param left
	 *            Starting double value
	 * @param step
	 *            Delta between any two adjacent doubles
	 */
	public StepDoubleGenerator(Double left, Double step) {
		super(left);
		this.step = step;

	}

	/**
	 * Delegate the call for generate
	 * 
	 * @param count
	 *            How many items to generate
	 * @return reference to self (this)
	 */
	public StepDoubleGenerator init(int count) {
		this.generate(count);
		return this;
	}

	@SuppressWarnings("boxing")
	@Override
	Double function(int index) {
		return this.start + (this.step * index);
	}

}
